#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.web.user.controller;

import java.util.List;

import javax.ejb.EJB;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import ${package}.user.UserService;
import ${package}.user.dto.UserVO;

@Controller
@RequestMapping("/user")
public class UserController
{
	@EJB
	private UserService userService;

	@RequestMapping("/create")
	public String createUser(@RequestParam String name, Model model)
	{
		UserVO user = new UserVO();
		user.setName(name);

		this.userService.createUser(user);
		model.addAttribute("status", "OK");

		return "user-create";
	}

	@RequestMapping("/list")
	public String listUsers(Model model)
	{
		List<UserVO> users = this.userService.listAllUsers();
		model.addAttribute("users", users);

		return "user-list";
	}
}
